package cn.wolfcode.trip.app.web.controller;

import cn.wolfcode.trip.base.domain.OfComment;
import cn.wolfcode.trip.base.service.IOfCommentService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

@Controller
@RequestMapping("/ofComments")
public class OfCommentController {

    @Autowired
    private IOfCommentService oFCommentService;



    //游记的子评论回复新增
    @ResponseBody
    @PostMapping("/subComm")
    public Object addOfsubComm(OfComment ofComment){
        oFCommentService.addOfsubComm(ofComment);
        return new JSONResult();
    }

    //游记的子评论点赞实现
    @ResponseBody
    @PostMapping("/travel")
    public Object addOfComment(OfComment ofComment){
        oFCommentService.addOfComment(ofComment);
        return new JSONResult();
    }

    //游记的子评论的点赞数
    @ResponseBody
    @GetMapping("/travel/likeNums")
    public Object get(Long commentId){
        HashMap<String, Object> map = new HashMap<String, Object>();
        int likeNums = oFCommentService.getOfCommentsLikeNums(commentId);
        map.put("likeNums", likeNums);
        return map;
    }

    @PostMapping
    @ResponseBody
    public Object saveOfComment(OfComment ofComment){
        return null;
    }


    @GetMapping("/{id}")
    @ResponseBody
    public Object getLikerAndCollectorNums(@PathVariable Long strategyId){
        return null;
    }
}
